package com.polaris.live.im.sfs.processor

import com.polaris.live.im.sfs.core.ClientType
import com.polaris.live.im.sfs.core.bean.DataArgument

/**
 * MessageProcessor
 *
 * @author Created by lucas on 2023/10/19 10:18
 */
interface MessageProcessor {

    /**
     * 处理顺序
     */
    fun order(): Int

    /**
     * 是否应该处理
     */
    fun shouldProcess(@ClientType type: Int, command: String): Boolean

    /**
     * 处理消息
     */
    suspend fun process(@ClientType type: Int, command: String, argument: DataArgument): MessageProcessSignal

}

/**
 * 处理信号
 *
 * @author Created by lucas on 2023/10/19 10:24
 * @since 1.0.0
 */
sealed interface MessageProcessSignal

/**
 * 继续下一个
 */
object ProceedMessageProcessSignal : MessageProcessSignal

/**
 * 中断处理
 */
object InterruptMessageProcessSignal : MessageProcessSignal
